<div id="Creating-a-branch"></div>
<div class="header">
<p>
Next: [[cvs: Accessing branches#Accessing branches|Accessing branches]], Previous: [[cvs: What branches are good for#What branches are good for|Branches motivation]], Up: [[cvs: Branching and merging#Branching and merging|Branching and merging]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>

----

<div id="Creating-a-branch-1"></div>
=== Creating a branch ===
<div id="index-Creating-a-branch"></div>
<div id="index-Branch_002c-creating-a"></div>
<div id="index-tag-_0028subcommand_0029_002c-creating-a-branch-using"></div>
<div id="index-rtag-_0028subcommand_0029_002c-creating-a-branch-using"></div>

You can create a branch with <code>tag -b</code>; for
example, assuming you&rsquo;re in a working copy:

<div class="example" style="margin-left: 3.2em">
 $ cvs tag -b rel-1-0-patches
</div>


This splits off a branch based on the current revisions
in the working copy, assigning that branch the name
&lsquo;<code>rel-1-0-patches</code>&rsquo;.

It is important to understand that branches get created
in the repository, not in the working copy.  Creating a
branch based on current revisions, as the above example
does, will ''not'' automatically switch the working
copy to be on the new branch.  For information on how
to do that, see [[cvs: Accessing branches#Accessing branches|Accessing branches]].

You can also create a branch without reference to any
working copy, by using <code>rtag</code>:

<div class="example" style="margin-left: 3.2em">
 $ cvs rtag -b -r rel-1-0 rel-1-0-patches tc
</div>

&lsquo;<code>-r rel-1-0</code>&rsquo; says that this branch should be
rooted at the revision that
corresponds to the tag &lsquo;<code>rel-1-0</code>&rsquo;.  It need not
be the most recent revision &ndash; it&rsquo;s often useful to
split a branch off an old revision (for example, when
fixing a bug in a past release otherwise known to be
stable).

As with &lsquo;<code>tag</code>&rsquo;, the &lsquo;<code>-b</code>&rsquo; flag tells
<code>rtag</code> to create a branch (rather than just a
symbolic revision name).  Note that the numeric
revision number that matches &lsquo;<code>rel-1-0</code>&rsquo; will
probably be different from file to file.

So, the full effect of the command is to create a new
branch &ndash; named &lsquo;<code>rel-1-0-patches</code>&rsquo; &ndash; in module
&lsquo;<code>tc</code>&rsquo;, rooted in the revision tree at the point tagged
by &lsquo;<code>rel-1-0</code>&rsquo;.

This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
